package com.zscat.mallplus.controller.business;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zscat.mallplus.annotation.IgnoreAuth;
import com.zscat.mallplus.annotation.SysLog;
import com.zscat.mallplus.controller.single.ApiBaseAction;
import com.zscat.mallplus.entity.vo.oms.OrderDetailResult;
import com.zscat.mallplus.entity.vo.sys.StoreParam;
import com.zscat.mallplus.exception.ApiMallPlusException;
import com.zscat.mallplus.oms.vo.StoreContentResult;
import com.zscat.mallplus.service.ums.service.IStoreService;
import com.zscat.mallplus.service.ums.service.IUmsMemberService;
import com.zscat.mallplus.service.ums.service.RedisService;
import com.zscat.mallplus.service.ums.service.impl.RedisUtil;
import com.zscat.mallplus.sys.entity.SysStore;
import com.zscat.mallplus.ums.entity.UmsMember;
import com.zscat.mallplus.util.JsonUtils;
import com.zscat.mallplus.utils.CommonResult;
import com.zscat.mallplus.utils.ValidatorUtils;
import com.zscat.mallplus.vo.Rediskey;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @author: loop.fu
 */
@RestController
@RequestMapping("/api/business")
public class BusinessController extends ApiBaseAction {

    @Resource
    private IStoreService storeService;

    /**
     * 商家合作说明
     *
     * @return
     */
    @IgnoreAuth
    @GetMapping(value = "/applyStorePage")
    public Object applyStorePage() {
        try {
            return new CommonResult().success( storeService.getApplyStorePageInfo());
        } catch (ApiMallPlusException e) {
            return new CommonResult().failed(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            return new CommonResult().failed();
        }
    }

    /**
     * 商家合作-提交入驻申请
     *
     * @param storeParam
     * @return
     */
    @IgnoreAuth
    @PostMapping(value = "/applyStore")
    public Object applyStore(StoreParam storeParam) {
        try {
            return new CommonResult().success(storeService.applyStoreV1(storeParam));
        } catch (ApiMallPlusException e) {
            return new CommonResult().failed(e.getMessage());
        } catch (Exception e) {
            e.printStackTrace();
            return new CommonResult().failed();
        }
    }

}
